Who knows the value of global variables in the qt qtscript script to access the global variable to change the global variable value; [closed]

Posted by dawntrees on Programmers See other posts from Programmers or by dawntrees
Published on 2012-06-29T09:01:10Z Indexed on 2012/06/29 9:22 UTC
Read the original article Hit count: 316

Filed under:
|

Who knows the value of global variables in the qt qtscript script to access the global variable to change the global variable value; forexample

int gVar=0;

int main(int argc, char *argv[]) { QScriptEngine engine; QScriptValue varValue = m_engine->newVariant(gVar); engine.globalObject().setProperty("gVar", varValue);

  QScriptValue result = m_engine->evaluate("gVar=100;");
 qDebug()<<"gVar================"<<gVar;

 return 0;

} Why gVar = 0 and not equal to 100; how can we make gVar equal to 100(gVar=100) Who can help group I appreciate it, thanks!

© Programmers or respective owner

Related posts about c++

Related posts about qt